package com.xmy.cultivate.controller;

import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.xmy.cultivate.entity.Quarter;
import com.xmy.cultivate.entity.StudentGrade;
import com.xmy.cultivate.entity.excelEntity.SingleOrDoubleDateFour;
import com.xmy.cultivate.entity.excelEntity.SingleOrDoubleDateThree;
import com.xmy.cultivate.entity.excelEntity.SingleOrDoubleDateTwo;
import com.xmy.cultivate.entity.views.*;
import com.xmy.cultivate.feign.english.IFeiEnglishFeignClient;
import com.xmy.cultivate.feign.math.IFeiMathFeignClient;
import com.xmy.cultivate.feign.physics_outside.IPhysicsFeignClient;
import com.xmy.cultivate.feign.teacher_api.ITeacherApiFeignClient;
import com.xmy.cultivate.mapper.RenewClassMapper;
import com.xmy.cultivate.mapper.StudentGradeMapper;
import com.xmy.cultivate.service.*;
import com.xmy.cultivate.util.Code;
import com.xmy.cultivate.util.ExcelUtil;
import com.xmy.cultivate.util.PageResult;
import com.xmy.cultivate.util.Result;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.*;

import java.text.ParseException;
import java.time.LocalDate;
import java.util.*;

@RestController
@RequestMapping("/api/dataAnalysisTable")
public class DataAnalysisTableController extends BaseController {
    @Autowired
    IRecordCourseService iRecordCourseService;

    @Autowired
    IQuarterService iQuarterService;

    @Autowired
    @Lazy
    IStudyPlanService iStudyPlanService;

    @Autowired
    IFeiMathFeignClient iFeiMathFeignClient;

    @Autowired
    IPhysicsFeignClient iPhysicsFeignClient;

    @Autowired
    IStaffService iStaffService;

    @Autowired
    IOrganizationService iOrganizationService;

    @Autowired
    IRenewClassService iRenewClassService;

    @Autowired
    @Lazy
    RenewClassMapper renewClassMapper;

    @Autowired
    @Lazy
    StudentGradeMapper studentGradeMapper;

    @Autowired
    private IFeiEnglishFeignClient iFeiEnglishFeignClient;

    @Autowired
    ITeacherApiFeignClient iTeacherApiFeignClient;


    /**
     * 到课率
     */
    @GetMapping("/arrivalRate")
    public List<ArrivalRate> arrivalRate(@RequestParam Map<String, String> reMap) {
        Result result = iTeacherApiFeignClient.arrivalRate(reMap);
        if (result != null && Objects.equals(result.getCode(), Code.OK)) {
            String jsonString = JSON.toJSONString(result.getData());
            PageResult pageResult = JSON.parseObject(jsonString, PageResult.class);
            String jsonString1 = JSON.toJSONString(pageResult.getRows());
            return JSON.parseArray(jsonString1, ArrivalRate.class);
        }
        return null;
    }

    /**
     * 迟到率、准时率
     */
    @GetMapping("/tardinessRate")
    public List<ArrivalRate> tardinessRate(@RequestParam Map<String, String> reMap) {
        String schoolId = null;
        if (reMap.get("schoolId") != null && !reMap.get("schoolId").isEmpty()) {
            schoolId = reMap.get("schoolId");
        }

        String[] schoolIdStr = new String[0];
        if (schoolId != null && !schoolId.isEmpty()) {
            schoolIdStr = schoolId.split(",");
            reMap.put("schoolId", null);
        }

        Result result = iTeacherApiFeignClient.tardinessRate(reMap,schoolIdStr);
        if (result != null && Objects.equals(result.getCode(), Code.OK)) {
            String jsonString = JSON.toJSONString(result.getData());
            PageResult pageResult = JSON.parseObject(jsonString, PageResult.class);
            String jsonString1 = JSON.toJSONString(pageResult.getRows());
            return JSON.parseArray(jsonString1, ArrivalRate.class);
        }
        return null;
    }

    /**
     * 英语通关率
     */
    @GetMapping("/getMinimumTaskProgressRate")
    public List<PassRade> getMinimumTaskProgressRate(@RequestParam Map<String, String> reMap) {
        reMap.put("readingStatus","0");
        reMap.put("passersStatus","1");
        reMap.put("tabsType","1");
        Result result = iTeacherApiFeignClient.getMinimumTaskProgressRate(reMap);
        if (result != null && Objects.equals(result.getCode(), Code.OK)) {
            String jsonString = JSON.toJSONString(result.getData());
            PageResult pageResult = JSON.parseObject(jsonString, PageResult.class);
            String jsonString1 = JSON.toJSONString(pageResult.getRows());
            return JSON.parseArray(jsonString1, PassRade.class);
        }
        return null;
    }

    /**
     * 数学通关率、正确率
     */
//    @GetMapping("/getMathPassRadeList")
    public List<MathChaPlan> getMathPassRadeList(Map<String,String> reMap){//@RequestParam
        String type = reMap.get("type") != null && !reMap.get("type").isEmpty() ? reMap.get("type") : "1";
        String lessonNumStart = "0";
        if (reMap.get("lessonNumStart") != null && !reMap.get("lessonNumStart").isEmpty()) {
            lessonNumStart = reMap.get("lessonNumStart");
        }
        String lessonNum = null;
        if (reMap.get("lessonNum") != null && !reMap.get("lessonNum").isEmpty()) {
            lessonNum = reMap.get("lessonNum");
        }
        String gradeSection = null;
        if (reMap.get("gradeSection") != null && !reMap.get("gradeSection").isEmpty()) {
            gradeSection = reMap.get("gradeSection");
        }
        String readingType = "1";
        if (reMap.get("readingType") != null && !reMap.get("readingType").isEmpty()) {
            readingType = reMap.get("readingType");
        }
        String passDate = null;
        if (reMap.get("passDate") != null && !reMap.get("passDate").isEmpty()) {
            passDate = reMap.get("passDate");
        }
        String passDateStart = null;
        if (reMap.get("passDateStart") != null && !reMap.get("passDateStart").isEmpty()) {
            passDateStart = reMap.get("passDateStart");
        }
        String passDateEnd = null;
        if (reMap.get("passDateEnd") != null && !reMap.get("passDateEnd").isEmpty()) {
            passDateEnd = reMap.get("passDateEnd");
        }
        String subjectsId = "2";

        String rightNumStartDateGet = null;
        if (reMap.get("rightNumStartDateGet") != null && !reMap.get("rightNumStartDateGet").isEmpty()) {
            rightNumStartDateGet = reMap.get("rightNumStartDateGet");
        }
        String rightNumEndDateGet = null;
        if (reMap.get("rightNumEndDateGet") != null && !reMap.get("rightNumEndDateGet").isEmpty()) {
            rightNumEndDateGet = reMap.get("rightNumEndDateGet");
        }
        String trackId = null;
        if (reMap.get("trackId") != null && !reMap.get("trackId").isEmpty()) {
            trackId = reMap.get("trackId");
        }
        String listState = "0";
        if (reMap.get("listState") != null && !reMap.get("listState").isEmpty()) {
            listState = reMap.get("listState");
        }
        String radeType = null;
        if (reMap.get("radeType") != null && !reMap.get("radeType").isEmpty()) {
            radeType = reMap.get("radeType");
        }
        String teacherId = null;
        if (reMap.get("teacherId") != null && !reMap.get("teacherId").isEmpty()) {
            teacherId = reMap.get("teacherId");
        }
        String name = null;
        if (reMap.get("name") != null && !reMap.get("name").isEmpty()) {
            name = reMap.get("name");
        }
        String include = null;
        if (reMap.get("include") != null && !reMap.get("include").isEmpty()) {
            include = reMap.get("include");
        }

        int isYearClass = 0;
        if (reMap.get("isYearClass") != null && !reMap.get("isYearClass").isEmpty()) {
            isYearClass = Integer.parseInt(reMap.get("isYearClass"));
        }

        String schoolId = null;
        if (reMap.get("schoolId") != null && !reMap.get("schoolId").isEmpty()) {
            schoolId = reMap.get("schoolId");
        }

        String yearPart = null;
        if (reMap.get("yearPart") != null && !reMap.get("yearPart").isEmpty()) {
            yearPart = reMap.get("yearPart");
        }

        String quarterNum = null;
        if (reMap.get("quarterNum") != null && !reMap.get("quarterNum").isEmpty()) {
            quarterNum = reMap.get("quarterNum");
        }

        String yearClassId = null;
        if (reMap.get("yearClassId") != null && !reMap.get("yearClassId").isEmpty()) {
            yearClassId = reMap.get("yearClassId");
        }

        if (StringUtils.isNotBlank(gradeSection)){
            yearClassId = "";
            if (gradeSection.contains("0")) {
                yearClassId += "0,1,2";
            }
            if (gradeSection.contains("1")) {
                if (!yearClassId.isEmpty()) {
                    yearClassId += ",";
                }
                yearClassId += "3,4,5,6";
            }
            if (gradeSection.contains("2")) {
                if (!yearClassId.isEmpty()) {
                    yearClassId += ",";
                }
                yearClassId += "7,8,9";
            }
            if (gradeSection.contains("3")) {
                if (!yearClassId.isEmpty()) {
                    yearClassId += ",";
                }
                yearClassId += "10,11,12";
            }
        }

        String classTypeId = null;
        if (reMap.get("classTypeId") != null && !reMap.get("classTypeId").isEmpty()) {
            classTypeId = reMap.get("classTypeId");
        }

        String schoolIdStr = schoolId;

        Quarter quarter = iQuarterService.getNowQuarter();

        String readingStatusStr = "1,5";//结课的
        String isBeforQuarter = "1";//是否之前学期1是，0否
        if (quarter!=null){
            //当前学期
            if (quarterNum != null && yearPart != null && yearPart.equals(quarter.getYearPart().toString()) && quarterNum.equals(quarter.getNum().toString())) {
                isBeforQuarter = "0";
                readingStatusStr = "1,5";
            }
        }
        if (readingType.equals("2")){
            readingStatusStr="1,3,4,5";
        }
        if (StringUtils.isBlank(passDate)){
            passDate = LocalDate.now().toString();
        }
        if (StringUtils.isBlank(passDateEnd)){
            passDateEnd = LocalDate.now().toString();
        }

        String rightNumStartDate = "";
        String rightNumEndDate = "";
        if (rightNumStartDateGet != null && !rightNumStartDateGet.isEmpty()) {
            rightNumStartDate = rightNumStartDateGet + " 00:00:00";
        }
        if (rightNumEndDateGet != null && !rightNumEndDateGet.isEmpty()) {
            rightNumEndDate = rightNumEndDateGet + " 23:59:59";
        }

        PassRadeViews passRade = new PassRadeViews();
        if (schoolIdStr != null) {
            passRade.setSchoolIdStr(schoolIdStr);
        }
        if (yearPart != null) {
            passRade.setYearPart(yearPart);
        }
        if (quarterNum != null) {
            passRade.setQuarterNum(quarterNum);
        }
        if (type != null) {
            passRade.setType(type);
        }
        if (lessonNumStart != null) {
            passRade.setLessonNumStart(lessonNumStart);
        }
        if (lessonNum != null) {
            passRade.setLessonNum(lessonNum);
        }
        if (yearClassId != null) {
            passRade.setYearClassId(yearClassId);
        }
        if (classTypeId != null) {
            passRade.setClassTypeId(classTypeId);
        }
        passRade.setReadingType(readingType);
        passRade.setReadingStatusStr(readingStatusStr);
        passRade.setIsBeforQuarter(isBeforQuarter);
        passRade.setPassDate(passDate);
        if (passDateStart != null) {
            passRade.setPassDateStart(passDateStart);
        }
        passRade.setPassDateEnd(passDateEnd);
        if (subjectsId != null) {
            passRade.setSubjectsId(subjectsId);
        }
        passRade.setRightNumStartDate(rightNumStartDate);
        passRade.setRightNumEndDate(rightNumEndDate);
        if (trackId != null) {
            passRade.setTrackId(trackId);
        }
        passRade.setIsYearClass(isYearClass);
        if (listState != null) {
            passRade.setListState(listState);
        }
        if (radeType != null) {
            passRade.setRadeType(radeType);
        }
        if (name != null) {
            passRade.setName(name);
        }
        if (include != null) {
            passRade.setInclude(include);
        }
        if (teacherId != null) {
            passRade.setTeacherId(teacherId);
        }

        Result result = iTeacherApiFeignClient.getPassRadeListMath(schoolId,yearPart,quarterNum,type,lessonNumStart,lessonNum,yearClassId,gradeSection,classTypeId,readingType,passDate,
                passDateStart,passDateEnd, subjectsId,rightNumStartDateGet,rightNumEndDateGet,trackId,listState,radeType,teacherId,name,include);
        if (result != null && Objects.equals(result.getCode(), Code.OK)) {
            String jsonString = JSON.toJSONString(result.getData());
            PageResult pageResult = JSON.parseObject(jsonString, PageResult.class);
            String jsonString1 = JSON.toJSONString(pageResult.getRows());
            return JSON.parseArray(jsonString1, MathChaPlan.class);
        }
        return null;
    }

    /**
     * 物理通关率、正确率
     */
//    @GetMapping("/getPhysicsPassRadeList")
    public List<MathChaPlan> getPhysicsPassRadeList(Map<String,String> reMap){//@RequestParam
        String type = reMap.get("type") != null && !reMap.get("type").isEmpty() ? reMap.get("type") : "1";
        String lessonNumStart = "0";
        if (reMap.get("lessonNumStart") != null && !reMap.get("lessonNumStart").isEmpty()) {
            lessonNumStart = reMap.get("lessonNumStart");
        }
        String lessonNum = null;
        if (reMap.get("lessonNum") != null && !reMap.get("lessonNum").isEmpty()) {
            lessonNum = reMap.get("lessonNum");
        }
        String gradeSection = null;
        if (reMap.get("gradeSection") != null && !reMap.get("gradeSection").isEmpty()) {
            gradeSection = reMap.get("gradeSection");
        }
        String readingType = "1";
        if (reMap.get("readingType") != null && !reMap.get("readingType").isEmpty()) {
            readingType = reMap.get("readingType");
        }
        String passDate = null;
        if (reMap.get("passDate") != null && !reMap.get("passDate").isEmpty()) {
            passDate = reMap.get("passDate");
        }
        String passDateStart = null;
        if (reMap.get("passDateStart") != null && !reMap.get("passDateStart").isEmpty()) {
            passDateStart = reMap.get("passDateStart");
        }
        String passDateEnd = null;
        if (reMap.get("passDateEnd") != null && !reMap.get("passDateEnd").isEmpty()) {
            passDateEnd = reMap.get("passDateEnd");
        }
        String subjectsId = "3";

        String rightNumStartDateGet = null;
        if (reMap.get("rightNumStartDateGet") != null && !reMap.get("rightNumStartDateGet").isEmpty()) {
            rightNumStartDateGet = reMap.get("rightNumStartDateGet");
        }
        String rightNumEndDateGet = null;
        if (reMap.get("rightNumEndDateGet") != null && !reMap.get("rightNumEndDateGet").isEmpty()) {
            rightNumEndDateGet = reMap.get("rightNumEndDateGet");
        }
        String trackId = null;
        if (reMap.get("trackId") != null && !reMap.get("trackId").isEmpty()) {
            trackId = reMap.get("trackId");
        }

        String listState = "0";
        if (reMap.get("listState") != null && !reMap.get("listState").isEmpty()) {
            listState = reMap.get("listState");
        }
        String radeType = null;
        if (reMap.get("radeType") != null && !reMap.get("radeType").isEmpty()) {
            radeType = reMap.get("radeType");
        }
        String teacherId = null;
        if (reMap.get("teacherId") != null && !reMap.get("teacherId").isEmpty()) {
            teacherId = reMap.get("teacherId");
        }

        String include = null;
        if (reMap.get("include") != null && !reMap.get("include").isEmpty()) {
            include = reMap.get("include");
        }

        String schoolId = null;
        if (reMap.get("schoolId") != null && !reMap.get("schoolId").isEmpty()) {
            schoolId = reMap.get("schoolId");
        }

        String yearPart = null;
        if (reMap.get("yearPart") != null && !reMap.get("yearPart").isEmpty()) {
            yearPart = reMap.get("yearPart");
        }

        String quarterNum = null;
        if (reMap.get("quarterNum") != null && !reMap.get("quarterNum").isEmpty()) {
            quarterNum = reMap.get("quarterNum");
        }

        String yearClassId = null;
        if (reMap.get("yearClassId") != null && !reMap.get("yearClassId").isEmpty()) {
            yearClassId = reMap.get("yearClassId");
        }

        if (StringUtils.isNotBlank(gradeSection)){
            yearClassId = "";
            if (gradeSection.contains("0")) {
                yearClassId += "0,1,2";
            }
            if (gradeSection.contains("1")) {
                if (!yearClassId.isEmpty()) {
                    yearClassId += ",";
                }
                yearClassId += "3,4,5,6";
            }
            if (gradeSection.contains("2")) {
                if (!yearClassId.isEmpty()) {
                    yearClassId += ",";
                }
                yearClassId += "7,8,9";
            }
            if (gradeSection.contains("3")) {
                if (!yearClassId.isEmpty()) {
                    yearClassId += ",";
                }
                yearClassId += "10,11,12";
            }
        }

        String classTypeId = null;
        if (reMap.get("classTypeId") != null && !reMap.get("classTypeId").isEmpty()) {
            classTypeId = reMap.get("classTypeId");
        }

        if (StringUtils.isBlank(passDate)){
            passDate = LocalDate.now().toString();
        }
        if (StringUtils.isBlank(passDateEnd)){
            passDateEnd = LocalDate.now().toString();
        }

        Result result = iTeacherApiFeignClient.getPassRadeListPhysics(schoolId,yearPart,quarterNum,type,lessonNumStart,lessonNum,yearClassId,gradeSection,classTypeId,readingType,passDate,
                passDateStart,passDateEnd, subjectsId,rightNumStartDateGet,rightNumEndDateGet,trackId,listState,radeType,teacherId,include);
        if (result != null && Objects.equals(result.getCode(), Code.OK)) {
            String jsonString = JSON.toJSONString(result.getData());
            PageResult pageResult = JSON.parseObject(jsonString, PageResult.class);
            String jsonString1 = JSON.toJSONString(pageResult.getRows());
            return JSON.parseArray(jsonString1, MathChaPlan.class);
        }
        return null;
    }

    /**
     * 交费率(缴费人数)
     */
    @GetMapping("/payFee")
    public List<RenewClassRecord> payFee(@RequestParam Map<String,String> reMap) {
        Result result = iTeacherApiFeignClient.payFee(reMap);
        if (result != null && Objects.equals(result.getCode(), Code.OK)) {
            String jsonString = JSON.toJSONString(result.getData());
            PageResult pageResult = JSON.parseObject(jsonString, PageResult.class);
            String jsonString1 = JSON.toJSONString(pageResult.getRows());
            return JSON.parseArray(jsonString1, RenewClassRecord.class);
        }
        return null;
    }

    /**
     * 续报率
     */
    @GetMapping("/continueFee")
    public List<ContinueInfo> continueFee(@RequestParam Map<String,String> reMap) throws ParseException {
        Result result = iTeacherApiFeignClient.continueFee(reMap);
        if (result != null && Objects.equals(result.getCode(), Code.OK)) {
            String jsonString = JSON.toJSONString(result.getData());
            PageResult pageResult = JSON.parseObject(jsonString, PageResult.class);
            String jsonString1 = JSON.toJSONString(pageResult.getRows());
            return JSON.parseArray(jsonString1, ContinueInfo.class);
        }
        return null;
    }

    private List<StudyPlan> getTeacherIdListData(Map<String,String> reMap) {
        String yearPart = reMap.get("yearPart") != null && !reMap.get("yearPart").isEmpty() ? reMap.get("yearPart") : null;
        String yearClassId = reMap.get("yearClassId") != null && !reMap.get("yearClassId").isEmpty() ? reMap.get("yearClassId") : null;
        Integer type = reMap.get("type") != null && !reMap.get("type").isEmpty() ? Integer.parseInt(reMap.get("type")) : 1;
        String subjectsId = reMap.get("subjectsId") != null && !reMap.get("subjectsId").isEmpty() ? reMap.get("subjectsId"): null;
        String quarterNum = reMap.get("quarterNum") != null && !reMap.get("quarterNum").isEmpty() ? reMap.get("quarterNum"): null;
        String trackId = reMap.get("trackId") != null && !reMap.get("trackId").isEmpty() ? reMap.get("trackId"): null;
        String gradeSection = reMap.get("gradeSection") != null && !reMap.get("gradeSection").isEmpty() ? reMap.get("gradeSection"): null;
        String courseTypeId = reMap.get("courseTypeId") != null && !reMap.get("courseTypeId").isEmpty() ? reMap.get("courseTypeId"): null;
        String teacherName = reMap.get("teacherName") != null && !reMap.get("teacherName").isEmpty() ? reMap.get("teacherName"): null;
        Quarter quarter = iQuarterService.getNowQuarter();
        if (StringUtils.isNotBlank(yearPart) && StringUtils.isNotBlank(quarterNum)) {
            quarter.setYearPart(Integer.parseInt(yearPart));
            quarter.setNum(Integer.parseInt(quarterNum));
        }

        QueryWrapper<RenewClassRecord> queryWrapper = new QueryWrapper<>();
        queryWrapper.inSql(StringUtils.isNotBlank(subjectsId), "subjects_id", subjectsId);
        queryWrapper.eq("lesson_type", 1);
        queryWrapper.eq("year_part", quarter.getYearPart());
        queryWrapper.eq("quarter_num", quarter.getNum());
        queryWrapper.eq("deleted", 0);

        if (StringUtils.isNotBlank(yearClassId)) {
            queryWrapper.inSql("year_class_id", yearClassId);
        }
        if (StringUtils.isNotBlank(gradeSection)) {
            if (gradeSection.equals("0")) {
                queryWrapper.in("year_class_id", 1, 2);//0, 先不包含0的
            } else if (gradeSection.equals("1")) {
                queryWrapper.in("year_class_id", 3, 4, 5, 6);
            } else if (gradeSection.equals("2")) {
                queryWrapper.in("year_class_id", 7, 8, 9);
            } else if (gradeSection.equals("3")) {
                queryWrapper.in("year_class_id", 10, 11, 12);
            }
        } else {
            queryWrapper.ne("year_class_id", 0);// 先不包含0的
        }
        queryWrapper.like(StringUtils.isNotBlank(teacherName), "teacher_name", teacherName);
        List<StudyPlan> studyPlanList = new ArrayList<>();
        List<RenewClassRecord> renewClassRecordList = null;

        List<String> groupBys = new ArrayList<>();
        //1老师，2校区老师，3校长，4校区
        if (type.equals(1) || type.equals(3)) {
            groupBys.add("teacher_id");
            if (StringUtils.isNotBlank(trackId)) {
                queryWrapper.inSql("teacher_id", "select sourse_id from track_detail where deleted = 0 and track_id =" + trackId);
            }
        }
        if (type.equals(2)) {
            groupBys.add("school_id,teacher_id");
        }
        if (type.equals(3)) {
            queryWrapper.inSql("teacher_id", "select admin_id from role_admin where role_id = 1568160887369994242");
        }
        if (type.equals(4)) {
            groupBys.add("school_id");
        }
        if (StringUtils.isNotBlank(subjectsId)) {
            groupBys.add("subjects_id");
        }

        queryWrapper.groupBy(groupBys);

        renewClassRecordList = renewClassMapper.getStudentGradeView(queryWrapper);

        if (renewClassRecordList != null) {
            for (RenewClassRecord renewClassRecord : renewClassRecordList) {
                StudyPlan studyPlan = new StudyPlan();
                BeanUtils.copyProperties(renewClassRecord, studyPlan);
                studyPlan.setSchoolId(renewClassRecord.getSchoolId());
                studyPlan.setTeacherId(renewClassRecord.getTeacherId());

                QueryWrapper<StudentGrade> studentGradeQueryWrapper = new QueryWrapper<>();
                studentGradeQueryWrapper.eq("lesson_type", 1);
                studentGradeQueryWrapper.inSql("subjects_id", subjectsId);

                //1 老师，2校区老师，3 校长，4校区
                if (type.equals(2)) {
                    studentGradeQueryWrapper.eq("school_id", renewClassRecord.getSchoolId());
                    studentGradeQueryWrapper.inSql("grade_id", "select id from grade where school_id = " + renewClassRecord.getSchoolId() + " and teacher_id = " + renewClassRecord.getTeacherId());
                } else if (type.equals(3)) {
                    studentGradeQueryWrapper.inSql("grade_id", "select id from grade where teacher_id = " + renewClassRecord.getTeacherId());
                } else if (type.equals(4)) {
                    studentGradeQueryWrapper.eq("school_id", renewClassRecord.getSchoolId());
                } else {
                    studentGradeQueryWrapper.inSql("grade_id", "select id from grade where teacher_id = " + renewClassRecord.getTeacherId());
                }

                studentGradeQueryWrapper.inSql(StringUtils.isNotBlank(subjectsId), "subjects_id", subjectsId);
                studentGradeQueryWrapper.eq("year_part", quarter.getYearPart());
                studentGradeQueryWrapper.eq("quarter_num", quarter.getNum());
                studentGradeQueryWrapper.notIn("status", 3, 4);//订单作废的不算,转校转出的不算
                studentGradeQueryWrapper.eq("deleted", 0);
                studentGradeQueryWrapper.eq("is_last", 1);
                studentGradeQueryWrapper.ne("is_makeup", 1);//是否补课（跨学期补课，统计率要排除掉）
                if (StringUtils.isNotBlank(yearClassId)) {
                    List<String> yearClassList = Arrays.asList(yearClassId.split(","));
                    studentGradeQueryWrapper.in("year_class_id", yearClassList);
                }
                if (StringUtils.isNotBlank(gradeSection)) {
                    if (gradeSection.equals("0")) {
                        studentGradeQueryWrapper.in("year_class_id", 1, 2);//0, 先不包含0的
                    } else if (gradeSection.equals("1")) {
                        studentGradeQueryWrapper.in("year_class_id", 3, 4, 5, 6);
                    } else if (gradeSection.equals("2")) {
                        studentGradeQueryWrapper.in("year_class_id", 7, 8, 9);
                    } else if (gradeSection.equals("3")) {
                        studentGradeQueryWrapper.in("year_class_id", 10, 11, 12);
                    }
                } else {
                    studentGradeQueryWrapper.ne("year_class_id", 0);// 先不包含0的
                }

                if (courseTypeId != null) {
                    if (courseTypeId.equals("1565023758494501025")) {
                        studentGradeQueryWrapper.eq("course_type_id", 1575859909042028546L);//基础班，精品课为提高班
                    } else {
                        studentGradeQueryWrapper.eq("course_type_id", courseTypeId);
                    }

                }

                //获取带班总人数
                Integer studentAllCount = renewClassMapper.getStudentAllCount(studentGradeQueryWrapper);
                studyPlan.setAllStudentCount(studentAllCount);

                    studyPlan.setAlreadyShutNum(0);
                    studyPlan.setAllShutNum(0);
                    studyPlan.setPlanShutNumPass(0);
                    studyPlan.setShutNumShouldPassAll(0);
                    studyPlan.setNewNumAll(0);

                studyPlanList.add(studyPlan);
            }
        }
        return studyPlanList;
    }

    private List<SingleOrDoubleDate> returnStudyPlanList(List<StudyPlan> studyPlanList,Map<String,String> reMap,int isSingle,int isDouble,List<SingleOrDoubleDate> returnSingleData) throws ParseException {
        String type = reMap.get("type");
        //1到课率,2准时率,3通关率,4正确率,5缴费率,6续报率
        String project = reMap.get("project") != null && !reMap.get("project").isEmpty() ? reMap.get("project") : null;
        String[] projectArr = new String[0];
        if (project != null) {
            projectArr = project.split(",");
        }
        boolean contains1 = Arrays.asList(projectArr).contains("1");
        boolean contains2 = Arrays.asList(projectArr).contains("2");
        boolean contains3 = Arrays.asList(projectArr).contains("3");
        boolean contains4 = Arrays.asList(projectArr).contains("4");
        boolean contains5 = Arrays.asList(projectArr).contains("5");
        boolean contains6 = Arrays.asList(projectArr).contains("6");
        //到课
        List<ArrivalRate> toClassList = null;
        if (contains1) {
            toClassList = arrivalRate(reMap);
        }
        //迟到率、准时率
        List<ArrivalRate> punctualityList = null;
        if (contains2) {
            punctualityList = tardinessRate(reMap);
        }
        //英语通关率
        List<PassRade> minimumTaskList = null;
        //数学通关率
        List<MathChaPlan> mathPassRadeListL = null;
        //物理通关率
        List<MathChaPlan> physicsPassRadeListL = null;
        //数学正确率
        List<MathChaPlan> mathPassRadeListZ = null;
        //物理正确率
        List<MathChaPlan> physicsPassRadeListZ = null;
        if (contains3 || contains4) {
            if (reMap.get("subjectsId") != null && !reMap.get("subjectsId").isEmpty()) {
                String[] subjectsIdArr = reMap.get("subjectsId").split(",");
                boolean subjects1 = Arrays.asList(subjectsIdArr).contains("1");
                boolean subjects2 = Arrays.asList(subjectsIdArr).contains("2");
                boolean subjects3 = Arrays.asList(subjectsIdArr).contains("3");
                if (subjects1 && contains3) {
                    minimumTaskList = getMinimumTaskProgressRate(reMap);
                }
                if (subjects2) {
                    reMap.put("radeType","1");
                    reMap.put("readingType","2");
                    mathPassRadeListL = getMathPassRadeList(reMap);
                    reMap.put("radeType","2");
                    reMap.put("readingType","");
                    mathPassRadeListZ = getMathPassRadeList(reMap);
                }
                if (subjects3) {
                    reMap.put("radeType","1");
                    reMap.put("readingType","2");
                    physicsPassRadeListL = getPhysicsPassRadeList(reMap);
                    reMap.put("radeType","2");
                    reMap.put("readingType","");
                    physicsPassRadeListZ = getPhysicsPassRadeList(reMap);
                }
            } else {
                if (contains3) {
                    minimumTaskList = getMinimumTaskProgressRate(reMap);
                }
                reMap.put("radeType","1");
                reMap.put("readingType","2");
                mathPassRadeListL = getMathPassRadeList(reMap);
                physicsPassRadeListL = getPhysicsPassRadeList(reMap);
                reMap.put("radeType","2");
                reMap.put("readingType","");
                mathPassRadeListZ = getMathPassRadeList(reMap);
                physicsPassRadeListZ = getPhysicsPassRadeList(reMap);
            }
        }

        //交费率(缴费人数)
        List<RenewClassRecord> renewClassRecordsList = null;
        //续报率
        List<ContinueInfo> continueInfosList = null;
//        if (isSingle != 1) {
            if (contains5) {
                renewClassRecordsList = payFee(reMap);
            }
            if (contains6) {
                continueInfosList = continueFee(reMap);
            }
//        }
        //合计：
        //单日期
        int toClassStudentAllCountAll = 0; //到课率
        int arrivedCountAll = 0;
        int punctualityStudentAllCountAll = 0; //迟到率、准时率
        int tardinessRateCountAll = 0;
        int noArrivedCountAll = 0;
        int planShutNumPassAll = 0; //英语通关率
        int allShutNumAll = 0;
        int mathYetPassNumAll = 0; //数学通关率
        int mathShowPassNumAll = 0;
        int physicsYetPassNumAll = 0; //物理通关率
        int physicsShowPassNumAll = 0;
        int mathLowestShutnumAllAll = 0; //数学正确率
        int mathRightNumAllAll = 0;
        int physicsLowestShutnumAllAll = 0; //物理正确率
        int physicsRightNumAllAll = 0;
        int bigFifteenAll = 0; //交费率(缴费人数)
        int littleFifteenAll = 0;
        int continueStudentAllCountAll = 0; //续报率
        int schedulingCountAll = 0;

        //双日期对比
        int toClassStudentAllCountDoubleAll = 0; //到课率
        int arrivedCountDoubleAll = 0;
        int punctualityStudentAllCountDoubleAll = 0; //迟到率、准时率
        int tardinessRateCountDoubleAll = 0;
        int noArrivedCountDoubleAll = 0;
        int planShutNumPassDoubleAll = 0; //英语通关率
        int allShutNumDoubleAll = 0;
        int mathYetPassNumDoubleAll = 0; //数学通关率
        int mathShowPassNumDoubleAll = 0;
        int physicsYetPassNumDoubleAll = 0; //物理通关率
        int physicsShowPassNumDoubleAll = 0;
        int mathLowestShutnumAllDoubleAll = 0; //数学正确率
        int mathRightNumAllDoubleAll = 0;
        int physicsLowestShutnumAllDoubleAll = 0; //物理正确率
        int physicsRightNumAllDoubleAll = 0;
        int bigFifteenDoubleAll = 0; //交费率(缴费人数)
        int littleFifteenDoubleAll = 0;
        int continueStudentAllCountDoubleAll = 0; //续报率
        int schedulingCountDoubleAll = 0;
        List<SingleOrDoubleDate> singleOrDoubleDateList = new ArrayList<>();
        if (returnSingleData == null) {
            for (StudyPlan studyPlan : studyPlanList) {
                SingleOrDoubleDate singleOrDoubleDate = new SingleOrDoubleDate();
                BeanUtils.copyProperties(studyPlan, singleOrDoubleDate);
                //1个人；2校区老师；3校长；4校区
                if ("1".equals(type) || "2".equals(type) || "3".equals(type)) {
                    singleOrDoubleDate.setPropertyName(singleOrDoubleDate.getTeacherName());
                }
                if ("4".equals(type)) {
                    singleOrDoubleDate.setPropertyName(singleOrDoubleDate.getSchoolName());
                }
                if (toClassList != null && !toClassList.isEmpty()) {//到课
                    List<ArrivalRate> arrivalRateArrayList = new ArrayList<>();
                    int arrivedCount = 0;
                    int studentAllCount = 0;
                    for (ArrivalRate arrivalRate : toClassList) {
                        if (("1".equals(type) || "3".equals(type)) && Objects.equals(studyPlan.getTeacherId(), arrivalRate.getTeacherId())) {
                            arrivalRateArrayList.add(arrivalRate);
                            arrivedCount += arrivalRate.getArrivedCount();
                            studentAllCount += arrivalRate.getStudentAllCount();
                        }
                        if ("2".equals(type) && Objects.equals(studyPlan.getTeacherId(), arrivalRate.getTeacherId()) && Objects.equals(studyPlan.getSchoolId(), arrivalRate.getSchoolId())) {
                            arrivalRateArrayList.add(arrivalRate);
                            arrivedCount += arrivalRate.getArrivedCount();
                            studentAllCount += arrivalRate.getStudentAllCount();
                        }
                        if ("4".equals(type) && Objects.equals(studyPlan.getSchoolId(), arrivalRate.getSchoolId())) {
                            arrivalRateArrayList.add(arrivalRate);
                            arrivedCount += arrivalRate.getArrivedCount();
                            studentAllCount += arrivalRate.getStudentAllCount();
                        }
                    }
                    toClassStudentAllCountAll += studentAllCount; //到课率
                    arrivedCountAll += arrivedCount;
                    toClassStudentAllCountDoubleAll += studentAllCount; //到课率
                    arrivedCountDoubleAll += arrivedCount;
                    if (isDouble == 1) {
//                        singleOrDoubleDate.setToClassListDouble(arrivalRateArrayList);
                        singleOrDoubleDate.setArrivedCountDouble(arrivedCount);
                        singleOrDoubleDate.setToClassStudentAllCountDouble(studentAllCount);
                        if (arrivedCount > 0 && studentAllCount > 0) {
                            singleOrDoubleDate.setToClassCountDouble(String.format("%.2f",  (double) arrivedCount / studentAllCount * 100) + "%");
                        }
                    } else {
//                        singleOrDoubleDate.setToClassList(arrivalRateArrayList);
                        singleOrDoubleDate.setArrivedCount(arrivedCount);
                        singleOrDoubleDate.setToClassStudentAllCount(studentAllCount);
                        if (arrivedCount > 0 && studentAllCount > 0) {
                            singleOrDoubleDate.setToClassCount(String.format("%.2f",  (double) arrivedCount / studentAllCount * 100) + "%");
                        }
                    }
                }
                if (punctualityList != null && !punctualityList.isEmpty()) {//迟到率、准时率
                    List<ArrivalRate> arrivalRateArrayList = new ArrayList<>();
                    int studentAllCount = 0;
                    int tardinessRateCount = 0;
                    int noArrivedCount = 0;
                    for (ArrivalRate arrivalRate : punctualityList) {
                        if (("1".equals(type) || "3".equals(type)) && Objects.equals(studyPlan.getTeacherId(), arrivalRate.getTeacherId())) {
                            arrivalRateArrayList.add(arrivalRate);
                            studentAllCount += arrivalRate.getStudentAllCount();
                            tardinessRateCount += arrivalRate.getTardinessRateCount();
                            noArrivedCount += arrivalRate.getNoArrivedCount();
                        }
                        if ("2".equals(type) && Objects.equals(studyPlan.getTeacherId(), arrivalRate.getTeacherId()) && Objects.equals(studyPlan.getSchoolId(), arrivalRate.getSchoolId())) {
                            arrivalRateArrayList.add(arrivalRate);
                            studentAllCount += arrivalRate.getStudentAllCount();
                            tardinessRateCount += arrivalRate.getTardinessRateCount();
                            noArrivedCount += arrivalRate.getNoArrivedCount();
                        }
                        if ("4".equals(type) && Objects.equals(studyPlan.getSchoolId(), arrivalRate.getSchoolId())) {
                            arrivalRateArrayList.add(arrivalRate);
                            studentAllCount += arrivalRate.getStudentAllCount();
                            tardinessRateCount += arrivalRate.getTardinessRateCount();
                            noArrivedCount += arrivalRate.getNoArrivedCount();
                        }
                    }
                    punctualityStudentAllCountAll += studentAllCount; //迟到率、准时率
                    tardinessRateCountAll += tardinessRateCount;
                    noArrivedCountAll += noArrivedCount;
                    punctualityStudentAllCountDoubleAll = studentAllCount; //迟到率、准时率
                    tardinessRateCountDoubleAll += tardinessRateCount;
                    noArrivedCountDoubleAll += noArrivedCount;
                    if (isDouble == 1) {
//                        singleOrDoubleDate.setPunctualityListDouble(arrivalRateArrayList);
                        singleOrDoubleDate.setPunctualityStudentAllCountDouble(studentAllCount);
                        singleOrDoubleDate.setTardinessRateCountDouble(tardinessRateCount);
                        singleOrDoubleDate.setNoArrivedCountDouble(noArrivedCount);
                        if (tardinessRateCount > 0 && studentAllCount > 0) {
                            singleOrDoubleDate.setPunctualityCountDouble(String.format("%.2f",  (double) (studentAllCount - tardinessRateCount) / studentAllCount * 100) + "%");
                        }
                    } else {
//                        singleOrDoubleDate.setPunctualityList(arrivalRateArrayList);
                        singleOrDoubleDate.setPunctualityStudentAllCount(studentAllCount);
                        singleOrDoubleDate.setTardinessRateCount(tardinessRateCount);
                        singleOrDoubleDate.setNoArrivedCount(noArrivedCount);
                        if (tardinessRateCount > 0 && studentAllCount > 0) {
                            singleOrDoubleDate.setPunctualityCount(String.format("%.2f",  (double) (studentAllCount - tardinessRateCount) / studentAllCount * 100) + "%");
                        }
                    }
                }
                if (minimumTaskList != null && !minimumTaskList.isEmpty()) {//英语通关率
                    List<PassRade> passRadeArrayList = new ArrayList<>();
                    int planShutNumPass = 0;
                    int allShutNum = 0;
                    for (PassRade passRade : minimumTaskList) {
                        if (("1".equals(type) || "3".equals(type)) && Objects.equals(studyPlan.getTeacherId(), passRade.getTeacherId())) {
                            passRadeArrayList.add(passRade);
                            planShutNumPass += passRade.getPlanShutNumPass();
                            allShutNum += passRade.getAllShutNum();
                        }
                        if ("2".equals(type) && Objects.equals(studyPlan.getTeacherId(), passRade.getTeacherId()) && Objects.equals(studyPlan.getSchoolId(), passRade.getSchoolId())) {
                            passRadeArrayList.add(passRade);
                            planShutNumPass += passRade.getPlanShutNumPass();
                            allShutNum += passRade.getAllShutNum();
                        }
                        if ("4".equals(type) && Objects.equals(studyPlan.getSchoolId(), passRade.getSchoolId())) {
                            passRadeArrayList.add(passRade);
                            planShutNumPass += passRade.getPlanShutNumPass();
                            allShutNum += passRade.getAllShutNum();
                        }
                    }
                    planShutNumPassAll += planShutNumPass; //英语通关率
                    allShutNumAll += allShutNum;
                    planShutNumPassDoubleAll += planShutNumPass; //英语通关率
                    allShutNumDoubleAll += allShutNum;
                    if (isDouble == 1) {
//                        singleOrDoubleDate.setMinimumTaskListDouble(passRadeArrayList);
                        singleOrDoubleDate.setPlanShutNumPassDouble(planShutNumPass);
                        singleOrDoubleDate.setAllShutNumDouble(allShutNum);
                        if (planShutNumPass > 0 && allShutNum > 0) {
                            singleOrDoubleDate.setMinimumTaskCountDouble(String.format("%.2f",  (double) planShutNumPass / allShutNum * 100) + "%");
                        }
                    } else {
//                        singleOrDoubleDate.setMinimumTaskList(passRadeArrayList);
                        singleOrDoubleDate.setPlanShutNumPass(planShutNumPass);
                        singleOrDoubleDate.setAllShutNum(allShutNum);
                        if (planShutNumPass > 0 && allShutNum > 0) {
                            singleOrDoubleDate.setMinimumTaskCount(String.format("%.2f",  (double) planShutNumPass / allShutNum * 100) + "%");
                        }
                    }
                }
                if (mathPassRadeListL != null && !mathPassRadeListL.isEmpty()) {//数学通关率
                    List<MathChaPlan> mathChaPlanArrayList = new ArrayList<>();
                    int yetPassNum = 0;
                    int showPassNum = 0;
                    for (MathChaPlan mathChaPlan : mathPassRadeListL) {
                        if (("1".equals(type) || "3".equals(type)) && Objects.equals(studyPlan.getTeacherId(), mathChaPlan.getTeacherId())) {
                            //                            mathChaPlanArrayList.add(mathChaPlan);
                            yetPassNum += mathChaPlan.getYetPassNum();
                            showPassNum += mathChaPlan.getShowPassNum();
                        }
                        if ("2".equals(type) && Objects.equals(studyPlan.getTeacherId(), mathChaPlan.getTeacherId()) && Objects.equals(studyPlan.getSchoolId(), mathChaPlan.getSchoolId())) {
                            //                            mathChaPlanArrayList.add(mathChaPlan);
                            yetPassNum += mathChaPlan.getYetPassNum();
                            showPassNum += mathChaPlan.getShowPassNum();
                        }
                        if ("4".equals(type) && Objects.equals(studyPlan.getSchoolId(), mathChaPlan.getSchoolId())) {
                            //                            mathChaPlanArrayList.add(mathChaPlan);
                            yetPassNum += mathChaPlan.getYetPassNum();
                            showPassNum += mathChaPlan.getShowPassNum();
                        }
                    }
                    mathYetPassNumAll += yetPassNum; //数学通关率
                    mathShowPassNumAll += showPassNum;
                    mathYetPassNumDoubleAll += yetPassNum; //数学通关率
                    mathShowPassNumDoubleAll += showPassNum;
                    if (isDouble == 1) {
//                        singleOrDoubleDate.setMathPassRadeListDouble(mathChaPlanArrayList);
                        singleOrDoubleDate.setMathYetPassNumDouble(yetPassNum);
                        singleOrDoubleDate.setMathShowPassNumDouble(showPassNum);
                        if (yetPassNum > 0 && showPassNum > 0) {
                            singleOrDoubleDate.setMathPassRadeCountDouble(String.format("%.2f",  (double) yetPassNum / showPassNum * 100) + "%");
                        }
                    } else {
//                        singleOrDoubleDate.setMathPassRadeList(mathChaPlanArrayList);
                        singleOrDoubleDate.setMathYetPassNum(yetPassNum);
                        singleOrDoubleDate.setMathShowPassNum(showPassNum);
                        if (yetPassNum > 0 && showPassNum > 0) {
                            singleOrDoubleDate.setMathPassRadeCount(String.format("%.2f",  (double) yetPassNum / showPassNum * 100) + "%");
                        }
                    }
                }
                if (physicsPassRadeListL != null && !physicsPassRadeListL.isEmpty()) {//物理通关率
                    List<MathChaPlan> mathChaPlanArrayList = new ArrayList<>();
                    int yetPassNum = 0;
                    int showPassNum = 0;
                    for (MathChaPlan mathChaPlan : physicsPassRadeListL) {
                        if (("1".equals(type) || "3".equals(type)) && Objects.equals(studyPlan.getTeacherId(), mathChaPlan.getTeacherId())) {
                            mathChaPlanArrayList.add(mathChaPlan);
                            yetPassNum += mathChaPlan.getYetPassNum();
                            showPassNum += mathChaPlan.getShowPassNum();
                        }
                        if ("2".equals(type) && Objects.equals(studyPlan.getTeacherId(), mathChaPlan.getTeacherId()) && Objects.equals(studyPlan.getSchoolId(), mathChaPlan.getSchoolId())) {
                            mathChaPlanArrayList.add(mathChaPlan);
                            yetPassNum += mathChaPlan.getYetPassNum();
                            showPassNum += mathChaPlan.getShowPassNum();
                        }
                        if ("4".equals(type) && Objects.equals(studyPlan.getSchoolId(), mathChaPlan.getSchoolId())) {
                            mathChaPlanArrayList.add(mathChaPlan);
                            yetPassNum += mathChaPlan.getYetPassNum();
                            showPassNum += mathChaPlan.getShowPassNum();
                        }
                    }
                    physicsYetPassNumAll += yetPassNum; //物理通关率
                    physicsShowPassNumAll += showPassNum;
                    physicsYetPassNumDoubleAll += yetPassNum; //物理通关率
                    physicsShowPassNumDoubleAll += showPassNum;
                    if (isDouble == 1) {
//                        singleOrDoubleDate.setPhysicsPassRadeListDouble(mathChaPlanArrayList);
                        singleOrDoubleDate.setPhysicsYetPassNumDouble(yetPassNum);
                        singleOrDoubleDate.setPhysicsShowPassNumDouble(showPassNum);
                        if (yetPassNum > 0 && showPassNum > 0) {
                            singleOrDoubleDate.setPhysicsPassRadeCountDouble(String.format("%.2f",  (double) yetPassNum / showPassNum * 100) + "%");
                        }
                    } else {
//                        singleOrDoubleDate.setPhysicsPassRadeList(mathChaPlanArrayList);
                        singleOrDoubleDate.setPhysicsYetPassNum(yetPassNum);
                        singleOrDoubleDate.setPhysicsShowPassNum(showPassNum);
                        if (yetPassNum > 0 && showPassNum > 0) {
                            singleOrDoubleDate.setPhysicsPassRadeCount(String.format("%.2f",  (double) yetPassNum / showPassNum * 100) + "%");
                        }
                    }
                }
                if (mathPassRadeListZ != null && !mathPassRadeListZ.isEmpty()) {//数学正确率
                    List<MathChaPlan> mathChaPlanArrayList = new ArrayList<>();
                    int lowestShutnumAll = 0;
                    int rightNumAll = 0;
                    for (MathChaPlan mathChaPlan : mathPassRadeListZ) {
                        if (("1".equals(type) || "3".equals(type)) && Objects.equals(studyPlan.getTeacherId(), mathChaPlan.getTeacherId())) {
                            //                            mathChaPlanArrayList.add(mathChaPlan);
                            if (mathChaPlan.getLowestShutnumAll() != null) {
                                lowestShutnumAll += mathChaPlan.getLowestShutnumAll();
                            }
                            if (mathChaPlan.getRightNumAll() != null) {
                                rightNumAll += mathChaPlan.getRightNumAll();
                            }
                        }
                        if ("2".equals(type) && Objects.equals(studyPlan.getTeacherId(), mathChaPlan.getTeacherId()) && Objects.equals(studyPlan.getSchoolId(), mathChaPlan.getSchoolId())) {
                            //                            mathChaPlanArrayList.add(mathChaPlan);
                            if (mathChaPlan.getLowestShutnumAll() != null) {
                                lowestShutnumAll += mathChaPlan.getLowestShutnumAll();
                            }
                            if (mathChaPlan.getRightNumAll() != null) {
                                rightNumAll += mathChaPlan.getRightNumAll();
                            }
                        }
                        if ("4".equals(type) && Objects.equals(studyPlan.getSchoolId(), mathChaPlan.getSchoolId())) {
                            //                            mathChaPlanArrayList.add(mathChaPlan);
                            if (mathChaPlan.getLowestShutnumAll() != null) {
                                lowestShutnumAll += mathChaPlan.getLowestShutnumAll();
                            }
                            if (mathChaPlan.getRightNumAll() != null) {
                                rightNumAll += mathChaPlan.getRightNumAll();
                            }
                        }
                    }
                    mathLowestShutnumAllAll += lowestShutnumAll; //数学正确率
                    mathRightNumAllAll += rightNumAll;
                    mathLowestShutnumAllDoubleAll += lowestShutnumAll; //数学正确率
                    mathRightNumAllDoubleAll += rightNumAll;
                    if (isDouble == 1) {
//                        singleOrDoubleDate.setMathPassRadeListDouble(mathChaPlanArrayList);
                        singleOrDoubleDate.setMathLowestShutnumAllDouble(lowestShutnumAll);
                        singleOrDoubleDate.setMathRightNumAllDouble(rightNumAll);
                        if (rightNumAll > 0 && lowestShutnumAll > 0) {
                            singleOrDoubleDate.setMathAccuracyCountDouble(String.format("%.2f",  (double) rightNumAll / lowestShutnumAll * 100) + "%");
                        }
                    } else {
//                        singleOrDoubleDate.setMathPassRadeList(mathChaPlanArrayList);
                        singleOrDoubleDate.setMathLowestShutnumAll(lowestShutnumAll);
                        singleOrDoubleDate.setMathRightNumAll(rightNumAll);
                        if (rightNumAll > 0 && lowestShutnumAll > 0) {
                            singleOrDoubleDate.setMathAccuracyCount(String.format("%.2f",  (double) rightNumAll / lowestShutnumAll * 100) + "%");
                        }
                    }
                }
                if (physicsPassRadeListZ != null && !physicsPassRadeListZ.isEmpty()) {//物理正确率
                    List<MathChaPlan> mathChaPlanArrayList = new ArrayList<>();
                    int lowestShutnumAll = 0;
                    int rightNumAll = 0;
                    for (MathChaPlan mathChaPlan : physicsPassRadeListZ) {
                        if (("1".equals(type) || "3".equals(type)) && Objects.equals(studyPlan.getTeacherId(), mathChaPlan.getTeacherId())) {
                            mathChaPlanArrayList.add(mathChaPlan);
                            if (mathChaPlan.getLowestShutnumAll() != null) {
                                lowestShutnumAll += mathChaPlan.getLowestShutnumAll();
                            }
                            if (mathChaPlan.getRightNumAll() != null) {
                                rightNumAll += mathChaPlan.getRightNumAll();
                            }
                        }
                        if ("2".equals(type) && Objects.equals(studyPlan.getTeacherId(), mathChaPlan.getTeacherId()) && Objects.equals(studyPlan.getSchoolId(), mathChaPlan.getSchoolId())) {
                            mathChaPlanArrayList.add(mathChaPlan);
                            if (mathChaPlan.getLowestShutnumAll() != null) {
                                lowestShutnumAll += mathChaPlan.getLowestShutnumAll();
                            }
                            if (mathChaPlan.getRightNumAll() != null) {
                                rightNumAll += mathChaPlan.getRightNumAll();
                            }
                        }
                        if ("4".equals(type) && Objects.equals(studyPlan.getSchoolId(), mathChaPlan.getSchoolId())) {
                            mathChaPlanArrayList.add(mathChaPlan);
                            if (mathChaPlan.getLowestShutnumAll() != null) {
                                lowestShutnumAll += mathChaPlan.getLowestShutnumAll();
                            }
                            if (mathChaPlan.getRightNumAll() != null) {
                                rightNumAll += mathChaPlan.getRightNumAll();
                            }
                        }
                    }
                    physicsLowestShutnumAllAll += lowestShutnumAll; //物理正确率
                    physicsRightNumAllAll += rightNumAll;
                    physicsLowestShutnumAllDoubleAll += lowestShutnumAll; //物理正确率
                    physicsRightNumAllDoubleAll += rightNumAll;
                    if (isDouble == 1) {
//                        singleOrDoubleDate.setPhysicsPassRadeListDouble(mathChaPlanArrayList);
                        singleOrDoubleDate.setPhysicsLowestShutnumAllDouble(lowestShutnumAll);
                        singleOrDoubleDate.setPhysicsRightNumAllDouble(rightNumAll);
                        if (rightNumAll > 0 && lowestShutnumAll > 0) {
                            singleOrDoubleDate.setPhysicsAccuracyCountDouble(String.format("%.2f",  (double) rightNumAll / lowestShutnumAll * 100) + "%");
                        }
                    } else {
//                        singleOrDoubleDate.setPhysicsPassRadeList(mathChaPlanArrayList);
                        singleOrDoubleDate.setPhysicsLowestShutnumAll(lowestShutnumAll);
                        singleOrDoubleDate.setPhysicsRightNumAll(rightNumAll);
                        if (rightNumAll > 0 && lowestShutnumAll > 0) {
                            singleOrDoubleDate.setPhysicsAccuracyCount(String.format("%.2f",  (double) rightNumAll / lowestShutnumAll * 100) + "%");
                        }
                    }
                }
                if (renewClassRecordsList != null && !renewClassRecordsList.isEmpty()) {//交费率(缴费人数)
                    List<RenewClassRecord> renewClassRecordArrayList = new ArrayList<>();
                    int bigFifteen = 0;
                    int littleFifteen = 0;
                    for (RenewClassRecord renewClassRecord : renewClassRecordsList) {
                        if (("1".equals(type) || "3".equals(type)) && Objects.equals(studyPlan.getTeacherId(), renewClassRecord.getTeacherId())) {
                            renewClassRecordArrayList.add(renewClassRecord);
                            bigFifteen += renewClassRecord.getBigFifteen();
                            littleFifteen += renewClassRecord.getLittleFifteen();
                        }
                        if ("2".equals(type) && Objects.equals(studyPlan.getTeacherId(), renewClassRecord.getTeacherId()) && Objects.equals(studyPlan.getSchoolId(), renewClassRecord.getSchoolId())) {
                            renewClassRecordArrayList.add(renewClassRecord);
                            bigFifteen += renewClassRecord.getBigFifteen();
                            littleFifteen += renewClassRecord.getLittleFifteen();
                        }
                        if ("4".equals(type) && Objects.equals(studyPlan.getSchoolId(), renewClassRecord.getSchoolId())) {
                            renewClassRecordArrayList.add(renewClassRecord);
                            bigFifteen += renewClassRecord.getBigFifteen();
                            littleFifteen += renewClassRecord.getLittleFifteen();
                        }
                    }
                    bigFifteenAll += bigFifteen; //交费率(缴费人数)
                    littleFifteenAll += littleFifteen;
                    bigFifteenDoubleAll += bigFifteen; //交费率(缴费人数)
                    littleFifteenDoubleAll += littleFifteen;
                    if (isDouble == 1) {
//                        singleOrDoubleDate.setRenewClassRecordsListDouble(renewClassRecordArrayList);
                        singleOrDoubleDate.setBigFifteenDouble(bigFifteen);
                        singleOrDoubleDate.setLittleFifteenDouble(littleFifteen);
                        if (bigFifteen > 0 && littleFifteen > 0) {
                            singleOrDoubleDate.setRenewClassRecordsCountDouble(String.format("%.2f",  (double) bigFifteen / (bigFifteen + littleFifteen) * 100) + "%");
                        }
                    } else {
//                        singleOrDoubleDate.setRenewClassRecordsList(renewClassRecordArrayList);
                        singleOrDoubleDate.setBigFifteen(bigFifteen);
                        singleOrDoubleDate.setLittleFifteen(littleFifteen);
                        if (bigFifteen > 0 && littleFifteen > 0) {
                            singleOrDoubleDate.setRenewClassRecordsCount(String.format("%.2f",  (double) bigFifteen / (bigFifteen + littleFifteen) * 100) + "%");
                        }
                    }
                }
                if (continueInfosList != null && !continueInfosList.isEmpty()) {//续报率
                    List<ContinueInfo> continueInfoArrayList = new ArrayList<>();
                    int schedulingCount = 0;
                    int studentAllCount = 0;
                    for (ContinueInfo continueInfo : continueInfosList) {
                        if (("1".equals(type) || "3".equals(type)) && Objects.equals(studyPlan.getTeacherId(), continueInfo.getTeacherId())) {
                            continueInfoArrayList.add(continueInfo);
                            schedulingCount += continueInfo.getSchedulingCount();
                            studentAllCount += continueInfo.getStudentAllCount();
                        }
                        if ("2".equals(type) && Objects.equals(studyPlan.getTeacherId(), continueInfo.getTeacherId()) && Objects.equals(studyPlan.getSchoolId(), continueInfo.getSchoolId())) {
                            continueInfoArrayList.add(continueInfo);
                            schedulingCount += continueInfo.getSchedulingCount();
                            studentAllCount += continueInfo.getStudentAllCount();
                        }
                        if ("4".equals(type) && Objects.equals(studyPlan.getSchoolId(), continueInfo.getSchoolId())) {
                            continueInfoArrayList.add(continueInfo);
                            schedulingCount += continueInfo.getSchedulingCount();
                            studentAllCount += continueInfo.getStudentAllCount();
                        }
                    }
                    continueStudentAllCountAll += studentAllCount; //续报率
                    schedulingCountAll += schedulingCount;
                    continueStudentAllCountDoubleAll += studentAllCount; //续报率
                    schedulingCountDoubleAll += schedulingCount;
                    if (isDouble == 1) {
//                        singleOrDoubleDate.setContinueInfosListDouble(continueInfoArrayList);
                        singleOrDoubleDate.setSchedulingCountDouble(schedulingCount);
                        singleOrDoubleDate.setContinueStudentAllCountDouble(studentAllCount);
                        if (schedulingCount > 0 && studentAllCount > 0) {
                            singleOrDoubleDate.setContinueInfosCountDouble(String.format("%.2f",  (double) schedulingCount / studentAllCount * 100) + "%");
                        }
                    } else {
//                        singleOrDoubleDate.setContinueInfosList(continueInfoArrayList);
                        singleOrDoubleDate.setSchedulingCount(schedulingCount);
                        singleOrDoubleDate.setContinueStudentAllCount(studentAllCount);
                        if (schedulingCount > 0 && studentAllCount > 0) {
                            singleOrDoubleDate.setContinueInfosCount(String.format("%.2f",  (double) schedulingCount / studentAllCount * 100) + "%");
                        }
                    }
                }
                singleOrDoubleDateList.add(singleOrDoubleDate);
            }
        } else {
            for (SingleOrDoubleDate studyPlan : returnSingleData) {
                SingleOrDoubleDate singleOrDoubleDate = new SingleOrDoubleDate();
                BeanUtils.copyProperties(studyPlan, singleOrDoubleDate);
                //1个人；2校区老师；3校长；4校区
                if ("1".equals(type) || "2".equals(type) || "3".equals(type)) {
                    singleOrDoubleDate.setPropertyName(singleOrDoubleDate.getTeacherName());
                }
                if ("4".equals(type)) {
                    singleOrDoubleDate.setPropertyName(singleOrDoubleDate.getSchoolName());
                }
                if (toClassList != null && !toClassList.isEmpty()) {//到课
                    List<ArrivalRate> arrivalRateArrayList = new ArrayList<>();
                    int arrivedCount = 0;
                    int studentAllCount = 0;
                    for (ArrivalRate arrivalRate : toClassList) {
                        if (("1".equals(type) || "3".equals(type)) && Objects.equals(studyPlan.getTeacherId(), arrivalRate.getTeacherId())) {
                            arrivalRateArrayList.add(arrivalRate);
                            arrivedCount += arrivalRate.getArrivedCount();
                            studentAllCount += arrivalRate.getStudentAllCount();
                        }
                        if ("2".equals(type) && Objects.equals(studyPlan.getTeacherId(), arrivalRate.getTeacherId()) && Objects.equals(studyPlan.getSchoolId(), arrivalRate.getSchoolId())) {
                            arrivalRateArrayList.add(arrivalRate);
                            arrivedCount += arrivalRate.getArrivedCount();
                            studentAllCount += arrivalRate.getStudentAllCount();
                        }
                        if ("4".equals(type) && Objects.equals(studyPlan.getSchoolId(), arrivalRate.getSchoolId())) {
                            arrivalRateArrayList.add(arrivalRate);
                            arrivedCount += arrivalRate.getArrivedCount();
                            studentAllCount += arrivalRate.getStudentAllCount();
                        }
                    }
                    toClassStudentAllCountAll += studentAllCount; //到课率
                    arrivedCountAll += arrivedCount;
                    toClassStudentAllCountDoubleAll += studentAllCount; //到课率
                    arrivedCountDoubleAll += arrivedCount;
                    if (isDouble == 1) {
//                        singleOrDoubleDate.setToClassListDouble(arrivalRateArrayList);
                        singleOrDoubleDate.setArrivedCountDouble(arrivedCount);
                        singleOrDoubleDate.setToClassStudentAllCountDouble(studentAllCount);
                        if (arrivedCount > 0 && studentAllCount > 0) {
                            singleOrDoubleDate.setToClassCountDouble(String.format("%.2f",  (double) arrivedCount / studentAllCount * 100) + "%");
                        }
                    } else {
//                        singleOrDoubleDate.setToClassList(arrivalRateArrayList);
                        singleOrDoubleDate.setArrivedCount(arrivedCount);
                        singleOrDoubleDate.setToClassStudentAllCount(studentAllCount);
                        if (arrivedCount > 0 && studentAllCount > 0) {
                            singleOrDoubleDate.setToClassCount(String.format("%.2f",  (double) arrivedCount / studentAllCount * 100) + "%");
                        }
                    }
                }
                if (punctualityList != null && !punctualityList.isEmpty()) {//迟到率、准时率
                    List<ArrivalRate> arrivalRateArrayList = new ArrayList<>();
                    int studentAllCount = 0;
                    int tardinessRateCount = 0;
                    int noArrivedCount = 0;
                    for (ArrivalRate arrivalRate : punctualityList) {
                        if (("1".equals(type) || "3".equals(type)) && Objects.equals(studyPlan.getTeacherId(), arrivalRate.getTeacherId())) {
                            arrivalRateArrayList.add(arrivalRate);
                            studentAllCount += arrivalRate.getStudentAllCount();
                            tardinessRateCount += arrivalRate.getTardinessRateCount();
                            noArrivedCount += arrivalRate.getNoArrivedCount();
                        }
                        if ("2".equals(type) && Objects.equals(studyPlan.getTeacherId(), arrivalRate.getTeacherId()) && Objects.equals(studyPlan.getSchoolId(), arrivalRate.getSchoolId())) {
                            arrivalRateArrayList.add(arrivalRate);
                            studentAllCount += arrivalRate.getStudentAllCount();
                            tardinessRateCount += arrivalRate.getTardinessRateCount();
                            noArrivedCount += arrivalRate.getNoArrivedCount();
                        }
                        if ("4".equals(type) && Objects.equals(studyPlan.getSchoolId(), arrivalRate.getSchoolId())) {
                            arrivalRateArrayList.add(arrivalRate);
                            studentAllCount += arrivalRate.getStudentAllCount();
                            tardinessRateCount += arrivalRate.getTardinessRateCount();
                            noArrivedCount += arrivalRate.getNoArrivedCount();
                        }
                    }
                    punctualityStudentAllCountAll += studentAllCount; //迟到率、准时率
                    tardinessRateCountAll += tardinessRateCount;
                    noArrivedCountAll += noArrivedCount;
                    punctualityStudentAllCountDoubleAll = studentAllCount; //迟到率、准时率
                    tardinessRateCountDoubleAll += tardinessRateCount;
                    noArrivedCountDoubleAll += noArrivedCount;
                    if (isDouble == 1) {
//                        singleOrDoubleDate.setPunctualityListDouble(arrivalRateArrayList);
                        singleOrDoubleDate.setPunctualityStudentAllCountDouble(studentAllCount);
                        singleOrDoubleDate.setTardinessRateCountDouble(tardinessRateCount);
                        singleOrDoubleDate.setNoArrivedCountDouble(noArrivedCount);
                        if (tardinessRateCount > 0 && studentAllCount > 0) {
                            singleOrDoubleDate.setPunctualityCountDouble(String.format("%.2f",  (double) (studentAllCount - tardinessRateCount) / studentAllCount * 100) + "%");
                        }
                    } else {
//                        singleOrDoubleDate.setPunctualityList(arrivalRateArrayList);
                        singleOrDoubleDate.setPunctualityStudentAllCount(studentAllCount);
                        singleOrDoubleDate.setTardinessRateCount(tardinessRateCount);
                        singleOrDoubleDate.setNoArrivedCount(noArrivedCount);
                        if (tardinessRateCount > 0 && studentAllCount > 0) {
                            singleOrDoubleDate.setPunctualityCount(String.format("%.2f",  (double) (studentAllCount - tardinessRateCount) / studentAllCount * 100) + "%");
                        }
                    }
                }
                if (minimumTaskList != null && !minimumTaskList.isEmpty()) {//英语通关率
                    List<PassRade> passRadeArrayList = new ArrayList<>();
                    int planShutNumPass = 0;
                    int allShutNum = 0;
                    for (PassRade passRade : minimumTaskList) {
                        if (("1".equals(type) || "3".equals(type)) && Objects.equals(studyPlan.getTeacherId(), passRade.getTeacherId())) {
                            passRadeArrayList.add(passRade);
                            planShutNumPass += passRade.getPlanShutNumPass();
                            allShutNum += passRade.getAllShutNum();
                        }
                        if ("2".equals(type) && Objects.equals(studyPlan.getTeacherId(), passRade.getTeacherId()) && Objects.equals(studyPlan.getSchoolId(), passRade.getSchoolId())) {
                            passRadeArrayList.add(passRade);
                            planShutNumPass += passRade.getPlanShutNumPass();
                            allShutNum += passRade.getAllShutNum();
                        }
                        if ("4".equals(type) && Objects.equals(studyPlan.getSchoolId(), passRade.getSchoolId())) {
                            passRadeArrayList.add(passRade);
                            planShutNumPass += passRade.getPlanShutNumPass();
                            allShutNum += passRade.getAllShutNum();
                        }
                    }
                    planShutNumPassAll += planShutNumPass; //英语通关率
                    allShutNumAll += allShutNum;
                    planShutNumPassDoubleAll += planShutNumPass; //英语通关率
                    allShutNumDoubleAll += allShutNum;
                    if (isDouble == 1) {
//                        singleOrDoubleDate.setMinimumTaskListDouble(passRadeArrayList);
                        singleOrDoubleDate.setPlanShutNumPassDouble(planShutNumPass);
                        singleOrDoubleDate.setAllShutNumDouble(allShutNum);
                        if (planShutNumPass > 0 && allShutNum > 0) {
                            singleOrDoubleDate.setMinimumTaskCountDouble(String.format("%.2f",  (double) planShutNumPass / allShutNum * 100) + "%");
                        }
                    } else {
//                        singleOrDoubleDate.setMinimumTaskList(passRadeArrayList);
                        singleOrDoubleDate.setPlanShutNumPass(planShutNumPass);
                        singleOrDoubleDate.setAllShutNum(allShutNum);
                        if (planShutNumPass > 0 && allShutNum > 0) {
                            singleOrDoubleDate.setMinimumTaskCount(String.format("%.2f",  (double) planShutNumPass / allShutNum * 100) + "%");
                        }
                    }
                }
                if (mathPassRadeListL != null && !mathPassRadeListL.isEmpty()) {//数学通关率
                    List<MathChaPlan> mathChaPlanArrayList = new ArrayList<>();
                    int yetPassNum = 0;
                    int showPassNum = 0;
                    for (MathChaPlan mathChaPlan : mathPassRadeListL) {
                        if (("1".equals(type) || "3".equals(type)) && Objects.equals(studyPlan.getTeacherId(), mathChaPlan.getTeacherId())) {
                            //                            mathChaPlanArrayList.add(mathChaPlan);
                            yetPassNum += mathChaPlan.getYetPassNum();
                            showPassNum += mathChaPlan.getShowPassNum();
                        }
                        if ("2".equals(type) && Objects.equals(studyPlan.getTeacherId(), mathChaPlan.getTeacherId()) && Objects.equals(studyPlan.getSchoolId(), mathChaPlan.getSchoolId())) {
                            //                            mathChaPlanArrayList.add(mathChaPlan);
                            yetPassNum += mathChaPlan.getYetPassNum();
                            showPassNum += mathChaPlan.getShowPassNum();
                        }
                        if ("4".equals(type) && Objects.equals(studyPlan.getSchoolId(), mathChaPlan.getSchoolId())) {
                            //                            mathChaPlanArrayList.add(mathChaPlan);
                            yetPassNum += mathChaPlan.getYetPassNum();
                            showPassNum += mathChaPlan.getShowPassNum();
                        }
                    }
                    mathYetPassNumAll += yetPassNum; //数学通关率
                    mathShowPassNumAll += showPassNum;
                    mathYetPassNumDoubleAll += yetPassNum; //数学通关率
                    mathShowPassNumDoubleAll += showPassNum;
                    if (isDouble == 1) {
//                        singleOrDoubleDate.setMathPassRadeListDouble(mathChaPlanArrayList);
                        singleOrDoubleDate.setMathYetPassNumDouble(yetPassNum);
                        singleOrDoubleDate.setMathShowPassNumDouble(showPassNum);
                        if (yetPassNum > 0 && showPassNum > 0) {
                            singleOrDoubleDate.setMathPassRadeCountDouble(String.format("%.2f",  (double) yetPassNum / showPassNum * 100) + "%");
                        }
                    } else {
//                        singleOrDoubleDate.setMathPassRadeList(mathChaPlanArrayList);
                        singleOrDoubleDate.setMathYetPassNum(yetPassNum);
                        singleOrDoubleDate.setMathShowPassNum(showPassNum);
                        if (yetPassNum > 0 && showPassNum > 0) {
                            singleOrDoubleDate.setMathPassRadeCount(String.format("%.2f",  (double) yetPassNum / showPassNum * 100) + "%");
                        }
                    }
                }
                if (physicsPassRadeListL != null && !physicsPassRadeListL.isEmpty()) {//物理通关率
                    List<MathChaPlan> mathChaPlanArrayList = new ArrayList<>();
                    int yetPassNum = 0;
                    int showPassNum = 0;
                    for (MathChaPlan mathChaPlan : physicsPassRadeListL) {
                        if (("1".equals(type) || "3".equals(type)) && Objects.equals(studyPlan.getTeacherId(), mathChaPlan.getTeacherId())) {
                            mathChaPlanArrayList.add(mathChaPlan);
                            yetPassNum += mathChaPlan.getYetPassNum();
                            showPassNum += mathChaPlan.getShowPassNum();
                        }
                        if ("2".equals(type) && Objects.equals(studyPlan.getTeacherId(), mathChaPlan.getTeacherId()) && Objects.equals(studyPlan.getSchoolId(), mathChaPlan.getSchoolId())) {
                            mathChaPlanArrayList.add(mathChaPlan);
                            yetPassNum += mathChaPlan.getYetPassNum();
                            showPassNum += mathChaPlan.getShowPassNum();
                        }
                        if ("4".equals(type) && Objects.equals(studyPlan.getSchoolId(), mathChaPlan.getSchoolId())) {
                            mathChaPlanArrayList.add(mathChaPlan);
                            yetPassNum += mathChaPlan.getYetPassNum();
                            showPassNum += mathChaPlan.getShowPassNum();
                        }
                    }
                    physicsYetPassNumAll += yetPassNum; //物理通关率
                    physicsShowPassNumAll += showPassNum;
                    physicsYetPassNumDoubleAll += yetPassNum; //物理通关率
                    physicsShowPassNumDoubleAll += showPassNum;
                    if (isDouble == 1) {
//                        singleOrDoubleDate.setPhysicsPassRadeListDouble(mathChaPlanArrayList);
                        singleOrDoubleDate.setPhysicsYetPassNumDouble(yetPassNum);
                        singleOrDoubleDate.setPhysicsShowPassNumDouble(showPassNum);
                        if (yetPassNum > 0 && showPassNum > 0) {
                            singleOrDoubleDate.setPhysicsPassRadeCountDouble(String.format("%.2f",  (double) yetPassNum / showPassNum * 100) + "%");
                        }
                    } else {
//                        singleOrDoubleDate.setPhysicsPassRadeList(mathChaPlanArrayList);
                        singleOrDoubleDate.setPhysicsYetPassNum(yetPassNum);
                        singleOrDoubleDate.setPhysicsShowPassNum(showPassNum);
                        if (yetPassNum > 0 && showPassNum > 0) {
                            singleOrDoubleDate.setPhysicsPassRadeCount(String.format("%.2f",  (double) yetPassNum / showPassNum * 100) + "%");
                        }
                    }
                }
                if (mathPassRadeListZ != null && !mathPassRadeListZ.isEmpty()) {//数学正确率
                    List<MathChaPlan> mathChaPlanArrayList = new ArrayList<>();
                    int lowestShutnumAll = 0;
                    int rightNumAll = 0;
                    for (MathChaPlan mathChaPlan : mathPassRadeListZ) {
                        if (("1".equals(type) || "3".equals(type)) && Objects.equals(studyPlan.getTeacherId(), mathChaPlan.getTeacherId())) {
                            //                            mathChaPlanArrayList.add(mathChaPlan);
                            if (mathChaPlan.getLowestShutnumAll() != null) {
                                lowestShutnumAll += mathChaPlan.getLowestShutnumAll();
                            }
                            if (mathChaPlan.getRightNumAll() != null) {
                                rightNumAll += mathChaPlan.getRightNumAll();
                            }
                        }
                        if ("2".equals(type) && Objects.equals(studyPlan.getTeacherId(), mathChaPlan.getTeacherId()) && Objects.equals(studyPlan.getSchoolId(), mathChaPlan.getSchoolId())) {
                            //                            mathChaPlanArrayList.add(mathChaPlan);
                            if (mathChaPlan.getLowestShutnumAll() != null) {
                                lowestShutnumAll += mathChaPlan.getLowestShutnumAll();
                            }
                            if (mathChaPlan.getRightNumAll() != null) {
                                rightNumAll += mathChaPlan.getRightNumAll();
                            }
                        }
                        if ("4".equals(type) && Objects.equals(studyPlan.getSchoolId(), mathChaPlan.getSchoolId())) {
                            //                            mathChaPlanArrayList.add(mathChaPlan);
                            if (mathChaPlan.getLowestShutnumAll() != null) {
                                lowestShutnumAll += mathChaPlan.getLowestShutnumAll();
                            }
                            if (mathChaPlan.getRightNumAll() != null) {
                                rightNumAll += mathChaPlan.getRightNumAll();
                            }
                        }
                    }
                    mathLowestShutnumAllAll += lowestShutnumAll; //数学正确率
                    mathRightNumAllAll += rightNumAll;
                    mathLowestShutnumAllDoubleAll += lowestShutnumAll; //数学正确率
                    mathRightNumAllDoubleAll += rightNumAll;
                    if (isDouble == 1) {
//                        singleOrDoubleDate.setMathPassRadeListDouble(mathChaPlanArrayList);
                        singleOrDoubleDate.setMathLowestShutnumAllDouble(lowestShutnumAll);
                        singleOrDoubleDate.setMathRightNumAllDouble(rightNumAll);
                        if (rightNumAll > 0 && lowestShutnumAll > 0) {
                            singleOrDoubleDate.setMathAccuracyCountDouble(String.format("%.2f",  (double) rightNumAll / lowestShutnumAll * 100) + "%");
                        }
                    } else {
//                        singleOrDoubleDate.setMathPassRadeList(mathChaPlanArrayList);
                        singleOrDoubleDate.setMathLowestShutnumAll(lowestShutnumAll);
                        singleOrDoubleDate.setMathRightNumAll(rightNumAll);
                        if (rightNumAll > 0 && lowestShutnumAll > 0) {
                            singleOrDoubleDate.setMathAccuracyCount(String.format("%.2f",  (double) rightNumAll / lowestShutnumAll * 100) + "%");
                        }
                    }
                }
                if (physicsPassRadeListZ != null && !physicsPassRadeListZ.isEmpty()) {//物理正确率
                    List<MathChaPlan> mathChaPlanArrayList = new ArrayList<>();
                    int lowestShutnumAll = 0;
                    int rightNumAll = 0;
                    for (MathChaPlan mathChaPlan : physicsPassRadeListZ) {
                        if (("1".equals(type) || "3".equals(type)) && Objects.equals(studyPlan.getTeacherId(), mathChaPlan.getTeacherId())) {
                            mathChaPlanArrayList.add(mathChaPlan);
                            if (mathChaPlan.getLowestShutnumAll() != null) {
                                lowestShutnumAll += mathChaPlan.getLowestShutnumAll();
                            }
                            if (mathChaPlan.getRightNumAll() != null) {
                                rightNumAll += mathChaPlan.getRightNumAll();
                            }
                        }
                        if ("2".equals(type) && Objects.equals(studyPlan.getTeacherId(), mathChaPlan.getTeacherId()) && Objects.equals(studyPlan.getSchoolId(), mathChaPlan.getSchoolId())) {
                            mathChaPlanArrayList.add(mathChaPlan);
                            if (mathChaPlan.getLowestShutnumAll() != null) {
                                lowestShutnumAll += mathChaPlan.getLowestShutnumAll();
                            }
                            if (mathChaPlan.getRightNumAll() != null) {
                                rightNumAll += mathChaPlan.getRightNumAll();
                            }
                        }
                        if ("4".equals(type) && Objects.equals(studyPlan.getSchoolId(), mathChaPlan.getSchoolId())) {
                            mathChaPlanArrayList.add(mathChaPlan);
                            if (mathChaPlan.getLowestShutnumAll() != null) {
                                lowestShutnumAll += mathChaPlan.getLowestShutnumAll();
                            }
                            if (mathChaPlan.getRightNumAll() != null) {
                                rightNumAll += mathChaPlan.getRightNumAll();
                            }
                        }
                    }
                    physicsLowestShutnumAllAll += lowestShutnumAll; //物理正确率
                    physicsRightNumAllAll += rightNumAll;
                    physicsLowestShutnumAllDoubleAll += lowestShutnumAll; //物理正确率
                    physicsRightNumAllDoubleAll += rightNumAll;
                    if (isDouble == 1) {
//                        singleOrDoubleDate.setPhysicsPassRadeListDouble(mathChaPlanArrayList);
                        singleOrDoubleDate.setPhysicsLowestShutnumAllDouble(lowestShutnumAll);
                        singleOrDoubleDate.setPhysicsRightNumAllDouble(rightNumAll);
                        if (rightNumAll > 0 && lowestShutnumAll > 0) {
                            singleOrDoubleDate.setPhysicsAccuracyCountDouble(String.format("%.2f",  (double) rightNumAll / lowestShutnumAll * 100) + "%");
                        }
                    } else {
//                        singleOrDoubleDate.setPhysicsPassRadeList(mathChaPlanArrayList);
                        singleOrDoubleDate.setPhysicsLowestShutnumAll(lowestShutnumAll);
                        singleOrDoubleDate.setPhysicsRightNumAll(rightNumAll);
                        if (rightNumAll > 0 && lowestShutnumAll > 0) {
                            singleOrDoubleDate.setPhysicsAccuracyCount(String.format("%.2f",  (double) rightNumAll / lowestShutnumAll * 100) + "%");
                        }
                    }
                }
                if (renewClassRecordsList != null && !renewClassRecordsList.isEmpty()) {//交费率(缴费人数)
                    List<RenewClassRecord> renewClassRecordArrayList = new ArrayList<>();
                    int bigFifteen = 0;
                    int littleFifteen = 0;
                    for (RenewClassRecord renewClassRecord : renewClassRecordsList) {
                        if (("1".equals(type) || "3".equals(type)) && Objects.equals(studyPlan.getTeacherId(), renewClassRecord.getTeacherId())) {
                            renewClassRecordArrayList.add(renewClassRecord);
                            bigFifteen += renewClassRecord.getBigFifteen();
                            littleFifteen += renewClassRecord.getLittleFifteen();
                        }
                        if ("2".equals(type) && Objects.equals(studyPlan.getTeacherId(), renewClassRecord.getTeacherId()) && Objects.equals(studyPlan.getSchoolId(), renewClassRecord.getSchoolId())) {
                            renewClassRecordArrayList.add(renewClassRecord);
                            bigFifteen += renewClassRecord.getBigFifteen();
                            littleFifteen += renewClassRecord.getLittleFifteen();
                        }
                        if ("4".equals(type) && Objects.equals(studyPlan.getSchoolId(), renewClassRecord.getSchoolId())) {
                            renewClassRecordArrayList.add(renewClassRecord);
                            bigFifteen += renewClassRecord.getBigFifteen();
                            littleFifteen += renewClassRecord.getLittleFifteen();
                        }
                    }
                    bigFifteenAll += bigFifteen; //交费率(缴费人数)
                    littleFifteenAll += littleFifteen;
                    bigFifteenDoubleAll += bigFifteen; //交费率(缴费人数)
                    littleFifteenDoubleAll += littleFifteen;
                    if (isDouble == 1) {
//                        singleOrDoubleDate.setRenewClassRecordsListDouble(renewClassRecordArrayList);
                        singleOrDoubleDate.setBigFifteenDouble(bigFifteen);
                        singleOrDoubleDate.setLittleFifteenDouble(littleFifteen);
                        if (bigFifteen > 0 && littleFifteen > 0) {
                            singleOrDoubleDate.setRenewClassRecordsCountDouble(String.format("%.2f",  (double) bigFifteen / (bigFifteen + littleFifteen) * 100) + "%");
                        }
                    } else {
//                        singleOrDoubleDate.setRenewClassRecordsList(renewClassRecordArrayList);
                        singleOrDoubleDate.setBigFifteen(bigFifteen);
                        singleOrDoubleDate.setLittleFifteen(littleFifteen);
                        if (bigFifteen > 0 && littleFifteen > 0) {
                            singleOrDoubleDate.setRenewClassRecordsCount(String.format("%.2f",  (double) bigFifteen / (bigFifteen + littleFifteen) * 100) + "%");
                        }
                    }
                }
                if (continueInfosList != null && !continueInfosList.isEmpty()) {//续报率
                    List<ContinueInfo> continueInfoArrayList = new ArrayList<>();
                    int schedulingCount = 0;
                    int studentAllCount = 0;
                    for (ContinueInfo continueInfo : continueInfosList) {
                        if (("1".equals(type) || "3".equals(type)) && Objects.equals(studyPlan.getTeacherId(), continueInfo.getTeacherId())) {
                            continueInfoArrayList.add(continueInfo);
                            schedulingCount += continueInfo.getSchedulingCount();
                            studentAllCount += continueInfo.getStudentAllCount();
                        }
                        if ("2".equals(type) && Objects.equals(studyPlan.getTeacherId(), continueInfo.getTeacherId()) && Objects.equals(studyPlan.getSchoolId(), continueInfo.getSchoolId())) {
                            continueInfoArrayList.add(continueInfo);
                            schedulingCount += continueInfo.getSchedulingCount();
                            studentAllCount += continueInfo.getStudentAllCount();
                        }
                        if ("4".equals(type) && Objects.equals(studyPlan.getSchoolId(), continueInfo.getSchoolId())) {
                            continueInfoArrayList.add(continueInfo);
                            schedulingCount += continueInfo.getSchedulingCount();
                            studentAllCount += continueInfo.getStudentAllCount();
                        }
                    }
                    continueStudentAllCountAll += studentAllCount; //续报率
                    schedulingCountAll += schedulingCount;
                    continueStudentAllCountDoubleAll += studentAllCount; //续报率
                    schedulingCountDoubleAll += schedulingCount;
                    if (isDouble == 1) {
//                        singleOrDoubleDate.setContinueInfosListDouble(continueInfoArrayList);
                        singleOrDoubleDate.setSchedulingCountDouble(schedulingCount);
                        singleOrDoubleDate.setContinueStudentAllCountDouble(studentAllCount);
                        if (schedulingCount > 0 && studentAllCount > 0) {
                            singleOrDoubleDate.setContinueInfosCountDouble(String.format("%.2f",  (double) schedulingCount / studentAllCount * 100) + "%");
                        }
                    } else {
//                        singleOrDoubleDate.setContinueInfosList(continueInfoArrayList);
                        singleOrDoubleDate.setSchedulingCount(schedulingCount);
                        singleOrDoubleDate.setContinueStudentAllCount(studentAllCount);
                        if (schedulingCount > 0 && studentAllCount > 0) {
                            singleOrDoubleDate.setContinueInfosCount(String.format("%.2f",  (double) schedulingCount / studentAllCount * 100) + "%");
                        }
                    }
                }
                singleOrDoubleDateList.add(singleOrDoubleDate);
            }
        }
        //合计：
        if (!singleOrDoubleDateList.isEmpty()) {
            SingleOrDoubleDate singleOrDoubleDate = new SingleOrDoubleDate();
            singleOrDoubleDate.setPropertyName("合计");
            if (isDouble == 1) {
                if (toClassStudentAllCountDoubleAll > 0 && arrivedCountDoubleAll > 0) {
                    singleOrDoubleDate.setToClassCountDouble(String.format("%.2f", (double) arrivedCountDoubleAll / toClassStudentAllCountDoubleAll * 100) + "%");
                }
                if (punctualityStudentAllCountDoubleAll > 0 && tardinessRateCountDoubleAll > 0) {
                    singleOrDoubleDate.setPunctualityCountDouble(String.format("%.2f", (double) (punctualityStudentAllCountDoubleAll - tardinessRateCountDoubleAll) /  punctualityStudentAllCountDoubleAll * 100) + "%");
                }
                if (planShutNumPassDoubleAll > 0 && allShutNumDoubleAll > 0) {
                    singleOrDoubleDate.setMinimumTaskCountDouble(String.format("%.2f", (double) planShutNumPassDoubleAll / allShutNumDoubleAll * 100) + "%");
                }
                if (mathYetPassNumDoubleAll > 0 && mathShowPassNumDoubleAll > 0) {
                    singleOrDoubleDate.setMathPassRadeCountDouble(String.format("%.2f", (double) mathYetPassNumDoubleAll / mathShowPassNumDoubleAll * 100) + "%");
                }
                if (physicsYetPassNumDoubleAll > 0 && physicsShowPassNumDoubleAll > 0) {
                    singleOrDoubleDate.setPhysicsPassRadeCountDouble(String.format("%.2f", (double) physicsYetPassNumDoubleAll / physicsShowPassNumDoubleAll * 100) + "%");
                }
                if (mathLowestShutnumAllDoubleAll > 0 && mathRightNumAllDoubleAll > 0) {
                    singleOrDoubleDate.setMathAccuracyCountDouble(String.format("%.2f", (double) mathRightNumAllDoubleAll / mathLowestShutnumAllDoubleAll * 100) + "%");
                }
                if (physicsLowestShutnumAllDoubleAll > 0 && physicsRightNumAllDoubleAll > 0) {
                    singleOrDoubleDate.setPhysicsAccuracyCountDouble(String.format("%.2f", (double) physicsRightNumAllDoubleAll / physicsLowestShutnumAllDoubleAll * 100) + "%");
                }
                if (bigFifteenDoubleAll > 0 && littleFifteenDoubleAll > 0) {
                    singleOrDoubleDate.setRenewClassRecordsCountDouble(String.format("%.2f", (double) bigFifteenDoubleAll / (bigFifteenDoubleAll + littleFifteenDoubleAll) * 100) + "%");
                }
                if (continueStudentAllCountDoubleAll > 0 && schedulingCountDoubleAll > 0) {
                    singleOrDoubleDate.setContinueInfosCountDouble(String.format("%.2f", (double) schedulingCountDoubleAll / continueStudentAllCountDoubleAll * 100) + "%");
                }
            } else {
                if (toClassStudentAllCountAll > 0 && arrivedCountAll > 0) {
                    singleOrDoubleDate.setToClassCount(String.format("%.2f", (double) arrivedCountAll / toClassStudentAllCountAll * 100) + "%");
                }
                if (punctualityStudentAllCountAll > 0 && tardinessRateCountAll > 0) {
                    singleOrDoubleDate.setPunctualityCount(String.format("%.2f", (double) (punctualityStudentAllCountAll - tardinessRateCountAll) /  punctualityStudentAllCountAll * 100) + "%");
                }
                if (planShutNumPassAll > 0 && allShutNumAll > 0) {
                    singleOrDoubleDate.setMinimumTaskCount(String.format("%.2f", (double) planShutNumPassAll / allShutNumAll * 100) + "%");
                }
                if (mathYetPassNumAll > 0 && mathShowPassNumAll > 0) {
                    singleOrDoubleDate.setMathPassRadeCount(String.format("%.2f", (double) mathYetPassNumAll / mathShowPassNumAll * 100) + "%");
                }
                if (physicsYetPassNumAll > 0 && physicsShowPassNumAll > 0) {
                    singleOrDoubleDate.setPhysicsPassRadeCount(String.format("%.2f", (double) physicsYetPassNumAll / physicsShowPassNumAll * 100) + "%");
                }
                if (mathLowestShutnumAllAll > 0 && mathRightNumAllAll > 0) {
                    singleOrDoubleDate.setMathAccuracyCount(String.format("%.2f", (double) mathRightNumAllAll / mathLowestShutnumAllAll * 100) + "%");
                }
                if (physicsLowestShutnumAllAll > 0 && physicsRightNumAllAll > 0) {
                    singleOrDoubleDate.setPhysicsAccuracyCount(String.format("%.2f", (double) physicsRightNumAllAll / physicsLowestShutnumAllAll * 100) + "%");
                }
                if (bigFifteenAll > 0 && littleFifteenAll > 0) {
                    singleOrDoubleDate.setRenewClassRecordsCount(String.format("%.2f", (double) bigFifteenAll / (bigFifteenAll + littleFifteenAll) * 100) + "%");
                }
                if (continueStudentAllCountAll > 0 && schedulingCountAll > 0) {
                    singleOrDoubleDate.setContinueInfosCount(String.format("%.2f", (double) schedulingCountAll / continueStudentAllCountAll * 100) + "%");
                }
                singleOrDoubleDateList.add(singleOrDoubleDate);
            }
        }

        return singleOrDoubleDateList;
    }

    @GetMapping("getSingleDate")
    public Result getSingleDate(@RequestParam Map<String,String> reMap) throws ParseException {
        //班型
        reMap.put("courseTypeId",reMap.get("classTypeId"));
        //课次
        reMap.put("taskCourseNum",reMap.get("lessonNumStart"));
        reMap.put("taskCourseNumNow",reMap.get("lessonNum"));
        //教师名称
        reMap.put("name",reMap.get("teacherName"));
        //single date
        String startSingleDate = reMap.get("startSingleDate");
        String endSingleDate = reMap.get("endSingleDate");
        reMap.put("startDate",startSingleDate);
        reMap.put("endDate",endSingleDate);
        reMap.put("rightNumStartDate",startSingleDate);
        reMap.put("rightNumEndDate",endSingleDate);
        reMap.put("taskDateStart",startSingleDate);
        reMap.put("taskDateEnd",endSingleDate);
        reMap.put("passDateStart",startSingleDate);
        reMap.put("passDateEnd",endSingleDate);
        List<StudyPlan> teacherIdListData = getTeacherIdListData(reMap);
        List<SingleOrDoubleDate> returnSingleData = returnStudyPlanList(teacherIdListData,reMap,1,0,null);
        return new Result(Code.OK, returnSingleData,"");
    }

    @GetMapping("getSingleDateExcel")
    public Result getSingleDateExcel(@RequestParam Map<String,String> reMap) throws ParseException {
        //班型
        reMap.put("courseTypeId",reMap.get("classTypeId"));
        //课次
        reMap.put("taskCourseNum",reMap.get("lessonNumStart"));
        reMap.put("taskCourseNumNow",reMap.get("lessonNum"));
        //教师名称
        reMap.put("name",reMap.get("teacherName"));
        //single date
        String startSingleDate = reMap.get("startSingleDate");
        String endSingleDate = reMap.get("endSingleDate");
        reMap.put("startDate",startSingleDate);
        reMap.put("endDate",endSingleDate);
        reMap.put("rightNumStartDate",startSingleDate);
        reMap.put("rightNumEndDate",endSingleDate);
        reMap.put("taskDateStart",startSingleDate);
        reMap.put("taskDateEnd",endSingleDate);
        reMap.put("passDateStart",startSingleDate);
        reMap.put("passDateEnd",endSingleDate);
        List<StudyPlan> teacherIdListData = getTeacherIdListData(reMap);
        List<SingleOrDoubleDate> returnSingleData = returnStudyPlanList(teacherIdListData,reMap,1,0,null);

        if (StringUtils.isNotBlank(reMap.get("type"))) {
            if ("1".equals(reMap.get("type"))) {
                excelOne(returnSingleData);
            }
            if ("2".equals(reMap.get("type"))) {
                excelTwo(returnSingleData);
            }
            if ("3".equals(reMap.get("type"))) {
                excelThree(returnSingleData);
            }
            if ("4".equals(reMap.get("type"))) {
                excelFour(returnSingleData);
            }
        } else {
            excelOne(returnSingleData);
        }

        return new Result(Code.OK,null,"导出成功");
    }

    private void excelOne(List<SingleOrDoubleDate> returnSingleData) {
        String fileName = "数据分析老师表格";
        ExcelUtil.export(fileName, returnSingleData, SingleOrDoubleDate.class, response);
    }
    private void excelTwo(List<SingleOrDoubleDate> returnSingleData) {
        String fileName = "数据分析校区老师表格";
        ExcelUtil.export(fileName, returnSingleData, SingleOrDoubleDateTwo.class, response);
    }
    private void excelThree(List<SingleOrDoubleDate> returnSingleData) {
        String fileName = "数据分析校长表格";
        ExcelUtil.export(fileName, returnSingleData, SingleOrDoubleDateThree.class, response);
    }
    private void excelFour(List<SingleOrDoubleDate> returnSingleData) {
        String fileName = "数据分析校区表格";
        ExcelUtil.export(fileName, returnSingleData, SingleOrDoubleDateFour.class, response);
    }

    @GetMapping("getDoubleDate")
    public Result getDoubleDate(@RequestParam Map<String,String> reMap) throws ParseException {
        //班型
        reMap.put("courseTypeId",reMap.get("classTypeId"));
        //课次
        reMap.put("taskCourseNum",reMap.get("lessonNumStart"));
        reMap.put("taskCourseNumNow",reMap.get("lessonNum"));
        //教师名称
        reMap.put("name",reMap.get("teacherName"));
        Map<String, String> cpMap = new HashMap<>(reMap);
        //single date
        String startSingleDate = reMap.get("startSingleDate");
        String endSingleDate = reMap.get("endSingleDate");
        reMap.put("startDate",startSingleDate);
        reMap.put("endDate",endSingleDate);
        reMap.put("rightNumStartDate",startSingleDate);
        reMap.put("rightNumEndDate",endSingleDate);
        reMap.put("taskDateStart",startSingleDate);
        reMap.put("taskDateEnd",endSingleDate);
        reMap.put("passDateStart",startSingleDate);
        reMap.put("passDateEnd",endSingleDate);
        List<StudyPlan> teacherIdListData = getTeacherIdListData(reMap);
        List<SingleOrDoubleDate> returnSingleData = returnStudyPlanList(teacherIdListData,reMap,2,0,null);
        //double date
        String startDoubleDate = reMap.get("startDoubleDate");
        String endDoubleDate = reMap.get("endDoubleDate");
        cpMap.put("startDate",startDoubleDate);
        cpMap.put("endDate",endDoubleDate);
        cpMap.put("rightNumStartDate",startDoubleDate);
        cpMap.put("rightNumEndDate",endDoubleDate);
        cpMap.put("taskDateStart",startDoubleDate);
        cpMap.put("taskDateEnd",endDoubleDate);
        cpMap.put("passDateStart",startDoubleDate);
        cpMap.put("passDateEnd",endDoubleDate);
        List<SingleOrDoubleDate> returnDoubleData = returnStudyPlanList(null,cpMap,2,1,returnSingleData);

        return new Result(Code.OK, returnDoubleData,"");
    }

    @GetMapping("getDoubleDateExcel")
    public Result getDoubleDateExcel(@RequestParam Map<String,String> reMap) throws ParseException {
        //班型
        reMap.put("courseTypeId",reMap.get("classTypeId"));
        //课次
        reMap.put("taskCourseNum",reMap.get("lessonNumStart"));
        reMap.put("taskCourseNumNow",reMap.get("lessonNum"));
        //教师名称
        reMap.put("name",reMap.get("teacherName"));
        Map<String, String> cpMap = new HashMap<>(reMap);
        //single date
        String startSingleDate = reMap.get("startSingleDate");
        String endSingleDate = reMap.get("endSingleDate");
        reMap.put("startDate",startSingleDate);
        reMap.put("endDate",endSingleDate);
        reMap.put("rightNumStartDate",startSingleDate);
        reMap.put("rightNumEndDate",endSingleDate);
        reMap.put("taskDateStart",startSingleDate);
        reMap.put("taskDateEnd",endSingleDate);
        reMap.put("passDateStart",startSingleDate);
        reMap.put("passDateEnd",endSingleDate);
        List<StudyPlan> teacherIdListData = getTeacherIdListData(reMap);
        List<SingleOrDoubleDate> returnSingleData = returnStudyPlanList(teacherIdListData,reMap,2,0,null);
        //double date
        String startDoubleDate = reMap.get("startDoubleDate");
        String endDoubleDate = reMap.get("endDoubleDate");
        cpMap.put("startDate",startDoubleDate);
        cpMap.put("endDate",endDoubleDate);
        cpMap.put("rightNumStartDate",startDoubleDate);
        cpMap.put("rightNumEndDate",endDoubleDate);
        cpMap.put("taskDateStart",startDoubleDate);
        cpMap.put("taskDateEnd",endDoubleDate);
        cpMap.put("passDateStart",startDoubleDate);
        cpMap.put("passDateEnd",endDoubleDate);
        List<SingleOrDoubleDate> returnDoubleData = returnStudyPlanList(null,cpMap,2,1,returnSingleData);

        String fileName = "数据分析表格";

        ExcelUtil.export(fileName, returnDoubleData, SingleOrDoubleDate.class, response);

        return new Result(Code.OK,null,"导出成功");
    }

    @GetMapping("getTaskNumberMax")
    public Result getTaskNumberMax(@RequestParam Map<String,String> reMap) {
        Integer yearPart = reMap.get("yearPart") != null && !reMap.get("yearPart").isEmpty() ? Integer.valueOf(reMap.get("yearPart")) : null;
        Integer quarterNum = reMap.get("quarterNum") != null && !reMap.get("quarterNum").isEmpty() ? Integer.valueOf(reMap.get("quarterNum")) : null;
        Integer yearClassId = reMap.get("yearClassId") != null && !reMap.get("yearClassId").isEmpty() ? Integer.valueOf(reMap.get("yearClassId")) : null;
        Long classTypeId = reMap.get("classTypeId") != null && !reMap.get("classTypeId").isEmpty() ? Long.valueOf(reMap.get("classTypeId")) : null;
        EduTask eduTask = new EduTask();
        if (yearPart != null) {
            eduTask.setYearPart(yearPart);
        }
        if (quarterNum != null) {
            eduTask.setQuarterNum(quarterNum);
        }
        if (yearClassId != null) {
            eduTask.setYearClassId(yearClassId);
        }
        if (classTypeId != null) {
            eduTask.setClassTypeId(classTypeId);
        }
        int taskCourseNum = 0;
        try {
            EduTask taskNumberMax = iFeiMathFeignClient.getTaskNumberMax(eduTask);
            if (taskNumberMax != null) {
                taskCourseNum = taskNumberMax.getTaskCourseNum();
            }
            EduTask taskNumberMax1 = iPhysicsFeignClient.getTaskNumberMax(eduTask);
            if (taskNumberMax1 != null) {
                taskCourseNum = Math.max(taskCourseNum, taskNumberMax1.getTaskCourseNum());
            }
            EduTask taskNumberMax2 = iFeiEnglishFeignClient.getTaskNumberMax(eduTask);
            if (taskNumberMax2 != null) {
                taskCourseNum = Math.max(taskCourseNum, taskNumberMax2.getTaskCourseNum());
            }
            return new Result(Code.OK, taskCourseNum,"");
        } catch (Exception ignored) {
        }
        return new Result(Code.OK, taskCourseNum,"最大课时");
    }
}
